package org.internet.UDP;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

public class ChatRoomSendDemo {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket();
        Scanner scanner = new Scanner(System.in);
        while (true) {
            String message = scanner.nextLine();
            if (message.equals("886")) {
                break;
            }
            byte[] buf = message.getBytes();
            InetAddress address = InetAddress.getByName("127.0.0.1");
            int port = 10086;
            DatagramPacket dp = new DatagramPacket(buf, message.length(), address, port);
            ds.send(dp);
        }

        ds.close();

    }
}
